package com.ebanma.cloud.user.enums;

import com.ebanma.cloud.constant.CommonConstant;
import lombok.AllArgsConstructor;
import lombok.Getter;

@AllArgsConstructor
public enum GrantTypeEnum {
    PASSWORD(CommonConstant.LOGIN_PHONE, "usernameStrategy"),
    PHONE(CommonConstant.LOGIN_PHONE, "phoneStrategy");

    @Getter
    private final String type;
    @Getter
    private final String value;

    public static String getValueByType(String type) {
        for (GrantTypeEnum grantTypeEnum : values()) {
            if (grantTypeEnum.getType().equals(type)) {
                return grantTypeEnum.getValue();
            }
        }
        return null;
    }

}
